Optimal. Leaf size=162 \[ -\frac {a^2 \left (b \left (3+\frac {b^2}{a^2}\right )+a \left (1+\frac {3 b^2}{a^2}\right ) \cos (c+d x)\right ) \csc ^2(c+d x)}{2 d}+\frac {(a+b)^2 (a+4 b) \log (1-\cos (c+d x))}{4 d}-\frac {b \left (3 a^2+2 b^2\right ) \log (\cos (c+d x))}{d}-\frac {(a-4 b) (a-b)^2 \log (1+\cos (c+d x))}{4 d}+\frac {3 a b^2 \sec (c+d x)}{d}+\frac {b^3 \sec ^2(c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.25, antiderivative size = 162, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {3957, 2916, 12,
1819, 1816} \begin {gather*} -\frac {b \left (3 a^2+2 b^2\right ) \log (\cos (c+d x))}{d}-\frac {a^2 \csc ^2(c+d x) \left (a \left (\frac {3 b^2}{a^2}+1\right ) \cos (c+d x)+b \left (\frac {b^2}{a^2}+3\right )\right )}{2 d}+\frac {3 a b^2 \sec (c+d x)}{d}+\frac {(a+b)^2 (a+4 b) \log (1-\cos (c+d x))}{4 d}-\frac {(a-4 b) (a-b)^2 \log (\cos (c+d x)+1)}{4 d}+\frac {b^3 \sec ^2(c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 1816
Rule 1819
Rule 2916
Rule 3957
Rubi steps
\begin {align*} \int \csc ^3(c+d x) (a+b \sec (c+d x))^3 \, dx &=-\int (-b-a \cos (c+d x))^3 \csc ^3(c+d x) \sec ^3(c+d x) \, dx\\ &=\frac {a^3 \text {Subst}\left (\int \frac {a^3 (-b+x)^3}{x^3 \left (a^2-x^2\right )^2} \, dx,x,-a \cos (c+d x)\right )}{d}\\ &=\frac {a^6 \text {Subst}\left (\int \frac {(-b+x)^3}{x^3 \left (a^2-x^2\right )^2} \, dx,x,-a \cos (c+d x)\right )}{d}\\ &=-\frac {a^2 \left (b \left (3+\frac {b^2}{a^2}\right )+a \left (1+\frac {3 b^2}{a^2}\right ) \cos (c+d x)\right ) \csc ^2(c+d x)}{2 d}-\frac {a^4 \text {Subst}\left (\int \frac {2 b^3-6 b^2 x+2 b \left (3+\frac {b^2}{a^2}\right ) x^2-\left (1+\frac {3 b^2}{a^2}\right ) x^3}{x^3 \left (a^2-x^2\right )} \, dx,x,-a \cos (c+d x)\right )}{2 d}\\ &=-\frac {a^2 \left (b \left (3+\frac {b^2}{a^2}\right )+a \left (1+\frac {3 b^2}{a^2}\right ) \cos (c+d x)\right ) \csc ^2(c+d x)}{2 d}-\frac {a^4 \text {Subst}\left (\int \left (-\frac {(a-4 b) (a-b)^2}{2 a^4 (a-x)}+\frac {2 b^3}{a^2 x^3}-\frac {6 b^2}{a^2 x^2}+\frac {2 \left (3 a^2 b+2 b^3\right )}{a^4 x}-\frac {(a+b)^2 (a+4 b)}{2 a^4 (a+x)}\right ) \, dx,x,-a \cos (c+d x)\right )}{2 d}\\ &=-\frac {a^2 \left (b \left (3+\frac {b^2}{a^2}\right )+a \left (1+\frac {3 b^2}{a^2}\right ) \cos (c+d x)\right ) \csc ^2(c+d x)}{2 d}+\frac {(a+b)^2 (a+4 b) \log (1-\cos (c+d x))}{4 d}-\frac {b \left (3 a^2+2 b^2\right ) \log (\cos (c+d x))}{d}-\frac {(a-4 b) (a-b)^2 \log (1+\cos (c+d x))}{4 d}+\frac {3 a b^2 \sec (c+d x)}{d}+\frac {b^3 \sec ^2(c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 4.69, size = 260, normalized size = 1.60 \begin {gather*} \frac {24 a b^2-(a+b)^3 \csc ^2\left (\frac {1}{2} (c+d x)\right )-4 (a-4 b) (a-b)^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-8 b \left (3 a^2+2 b^2\right ) \log (\cos (c+d x))+4 (a+b)^2 (a+4 b) \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+(a-b)^3 \sec ^2\left (\frac {1}{2} (c+d x)\right )+\frac {2 b^3}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {24 a b^2 \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}+\frac {2 b^3}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}-\frac {24 a b^2 \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}}{8 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.14, size = 162, normalized size = 1.00
method | result | size |
derivativedivides | \(\frac {b^{3} \left (\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )^{2}}-\frac {1}{\sin \left (d x +c \right )^{2}}+2 \ln \left (\tan \left (d x +c \right )\right )\right )+3 b^{2} a \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+3 b \,a^{2} \left (-\frac {1}{2 \sin \left (d x +c \right )^{2}}+\ln \left (\tan \left (d x +c \right )\right )\right )+a^{3} \left (-\frac {\csc \left (d x +c \right ) \cot \left (d x +c \right )}{2}+\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )}{d}\) | \(162\) |
default | \(\frac {b^{3} \left (\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )^{2}}-\frac {1}{\sin \left (d x +c \right )^{2}}+2 \ln \left (\tan \left (d x +c \right )\right )\right )+3 b^{2} a \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+3 b \,a^{2} \left (-\frac {1}{2 \sin \left (d x +c \right )^{2}}+\ln \left (\tan \left (d x +c \right )\right )\right )+a^{3} \left (-\frac {\csc \left (d x +c \right ) \cot \left (d x +c \right )}{2}+\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )}{d}\) | \(162\) |
norman | \(\frac {-\frac {a^{3}+3 b \,a^{2}+3 b^{2} a +b^{3}}{8 d}+\frac {\left (a^{3}+15 b^{2} a \right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}+\frac {\left (a^{3}-3 b \,a^{2}+3 b^{2} a -b^{3}\right ) \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}-\frac {\left (2 a^{3}-3 b \,a^{2}+30 b^{2} a -9 b^{3}\right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\frac {\left (a^{3}+6 b \,a^{2}+9 b^{2} a +4 b^{3}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}-\frac {b \left (3 a^{2}+2 b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}-\frac {b \left (3 a^{2}+2 b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) | \(250\) |
risch | \(\frac {a^{3} {\mathrm e}^{7 i \left (d x +c \right )}+9 b^{2} a \,{\mathrm e}^{7 i \left (d x +c \right )}+6 b \,a^{2} {\mathrm e}^{6 i \left (d x +c \right )}+4 b^{3} {\mathrm e}^{6 i \left (d x +c \right )}+3 a^{3} {\mathrm e}^{5 i \left (d x +c \right )}+3 b^{2} a \,{\mathrm e}^{5 i \left (d x +c \right )}+12 b \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}+3 a^{3} {\mathrm e}^{3 i \left (d x +c \right )}+3 b^{2} a \,{\mathrm e}^{3 i \left (d x +c \right )}+6 b \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}+4 b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+a^{3} {\mathrm e}^{i \left (d x +c \right )}+9 b^{2} a \,{\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{2 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b \,a^{2}}{d}+\frac {9 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b^{2} a}{2 d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b^{3}}{d}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{2 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b \,a^{2}}{d}-\frac {9 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b^{2} a}{2 d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b^{3}}{d}-\frac {3 b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) a^{2}}{d}-\frac {2 b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(425\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.27, size = 171, normalized size = 1.06 \begin {gather*} -\frac {{\left (a^{3} - 6 \, a^{2} b + 9 \, a b^{2} - 4 \, b^{3}\right )} \log \left (\cos \left (d x + c\right ) + 1\right ) - {\left (a^{3} + 6 \, a^{2} b + 9 \, a b^{2} + 4 \, b^{3}\right )} \log \left (\cos \left (d x + c\right ) - 1\right ) + 4 \, {\left (3 \, a^{2} b + 2 \, b^{3}\right )} \log \left (\cos \left (d x + c\right )\right ) + \frac {2 \, {\left (6 \, a b^{2} \cos \left (d x + c\right ) - {\left (a^{3} + 9 \, a b^{2}\right )} \cos \left (d x + c\right )^{3} + b^{3} - {\left (3 \, a^{2} b + 2 \, b^{3}\right )} \cos \left (d x + c\right )^{2}\right )}}{\cos \left (d x + c\right )^{4} - \cos \left (d x + c\right )^{2}}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.67, size = 290, normalized size = 1.79 \begin {gather*} -\frac {12 \, a b^{2} \cos \left (d x + c\right ) - 2 \, {\left (a^{3} + 9 \, a b^{2}\right )} \cos \left (d x + c\right )^{3} + 2 \, b^{3} - 2 \, {\left (3 \, a^{2} b + 2 \, b^{3}\right )} \cos \left (d x + c\right )^{2} + 4 \, {\left ({\left (3 \, a^{2} b + 2 \, b^{3}\right )} \cos \left (d x + c\right )^{4} - {\left (3 \, a^{2} b + 2 \, b^{3}\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (-\cos \left (d x + c\right )\right ) + {\left ({\left (a^{3} - 6 \, a^{2} b + 9 \, a b^{2} - 4 \, b^{3}\right )} \cos \left (d x + c\right )^{4} - {\left (a^{3} - 6 \, a^{2} b + 9 \, a b^{2} - 4 \, b^{3}\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - {\left ({\left (a^{3} + 6 \, a^{2} b + 9 \, a b^{2} + 4 \, b^{3}\right )} \cos \left (d x + c\right )^{4} - {\left (a^{3} + 6 \, a^{2} b + 9 \, a b^{2} + 4 \, b^{3}\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{4 \, {\left (d \cos \left (d x + c\right )^{4} - d \cos \left (d x + c\right )^{2}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sec {\left (c + d x \right )}\right )^{3} \csc ^{3}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 482 vs.
\(2 (154) = 308\).
time = 0.54, size = 482, normalized size = 2.98 \begin {gather*} -\frac {\frac {a^{3} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {3 \, a^{2} b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {3 \, a b^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {b^{3} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - 2 \, {\left (a^{3} + 6 \, a^{2} b + 9 \, a b^{2} + 4 \, b^{3}\right )} \log \left (\frac {{\left | -\cos \left (d x + c\right ) + 1 \right |}}{{\left | \cos \left (d x + c\right ) + 1 \right |}}\right ) + 8 \, {\left (3 \, a^{2} b + 2 \, b^{3}\right )} \log \left ({\left | -\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} - 1 \right |}\right ) - \frac {{\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3} - \frac {2 \, a^{3} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {12 \, a^{2} b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {18 \, a b^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {8 \, b^{3} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}{\cos \left (d x + c\right ) - 1} - \frac {4 \, {\left (9 \, a^{2} b + 12 \, a b^{2} + 6 \, b^{3} + \frac {18 \, a^{2} b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {12 \, a b^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {8 \, b^{3} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {9 \, a^{2} b {\left (\cos \left (d x + c\right ) - 1\right )}^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {6 \, b^{3} {\left (\cos \left (d x + c\right ) - 1\right )}^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )}}{{\left (\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} + 1\right )}^{2}}}{8 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.01, size = 159, normalized size = 0.98 \begin {gather*} \frac {\ln \left (\cos \left (c+d\,x\right )-1\right )\,{\left (a+b\right )}^2\,\left (a+4\,b\right )}{4\,d}-\frac {\ln \left (\cos \left (c+d\,x\right )\right )\,\left (3\,a^2\,b+2\,b^3\right )}{d}-\frac {{\cos \left (c+d\,x\right )}^3\,\left (\frac {a^3}{2}+\frac {9\,a\,b^2}{2}\right )-\frac {b^3}{2}+{\cos \left (c+d\,x\right )}^2\,\left (\frac {3\,a^2\,b}{2}+b^3\right )-3\,a\,b^2\,\cos \left (c+d\,x\right )}{d\,\left ({\cos \left (c+d\,x\right )}^2-{\cos \left (c+d\,x\right )}^4\right )}-\frac {\ln \left (\cos \left (c+d\,x\right )+1\right )\,{\left (a-b\right )}^2\,\left (a-4\,b\right )}{4\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________